import plotly.express as px
from eq_explore_data import Earthquake
import pandas as pd

for key in px.colors.named_colorscales():
    print(key)


readable_data = Earthquake("eq_data_7_day_m1.json")

data = pd.DataFrame(
    data=zip(readable_data.lons, readable_data.lats, readable_data.titles,
              readable_data.mags),
    columns=["经度", "维度", "位置", "震级"]
)

fig = px.scatter(
    data,
    x="经度",
    y="维度",
    range_x=[-200, 200],
    range_y=[-90, 90],
    width=800,
    height=800,
    title=readable_data.earthquake_title,
    size="震级",
    size_max=10,
    color="震级",
    hover_name="位置"
    # color_continuous_scale=px.colors.diverging.RdYlGn[::-1]
)

fig.write_html("global_earthquakes.html")
fig.show()